package Person.ith_09;

 class Animal {
 private String name;
 private int age;
 public String getName()
 {
     return name;
 }
 public void setName(String name)
 {
     this.name = name;
 }
 public int getAge()
 {
 return age;
 }
 public void setAge(int age)
 {
     this.age =age;
 }
}
//定义Dog继承 Animal类
//继承之后Dog可以访问Animal父类中的属性和方法
//但是子类只能访问父类中的public和proted修饰的属性和方法，  父类中被默认修饰符default和private修饰的属性和方法不能被子类访问


class Dog extends Animal{
     private String color;
     public String getColor()
     {
         return color;
     }
     public void setColor(String color)
     {
         this.color = color;
     }
}

class Main{
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.setName("二哈");
        dog.setAge(3);
        dog.setColor("黑白相间");
        System.out.println(dog.getColor()+dog.getName()+dog.getAge());
    }
}